using System;
using System.Collections.Generic;
using System.Text;
using Castle.ActiveRecord;

namespace DigitalFortress.Entities {
	/// <summary>
	/// Membership data of an user.
	/// </summary>
	[ActiveRecord("DF_Membership")]
	public partial class MembershipEntity {

		#region Fields
		private Guid userId;
		private string _password;
		private string _email;
		private System.DateTime? _lastLoginDate;
		private string _description;
		private UserEntity _user;
		#endregion Fields

		#region Properties
		/// <summary>
		/// UserId Property Name.
		/// </summary>
		public const string UserIdProperty = "UserId";
		/// <summary>
		/// User Id.
		/// </summary>
		[PrimaryKey(PrimaryKeyType.Foreign, "UserId")]
		public Guid UserId {
			get {
				return userId;
			}
			set {
				userId = value;
			}
		}

		/// <summary>
		/// Password Property Name.
		/// </summary>
		public const string PasswordProperty = "Password";
		/// <summary>
		/// Password hash for this user.
		/// </summary>
		[Property]
		public string Password {
			get {
				return this._password;
			}
			set {
				this._password = value;
			}
		}

		/// <summary>
		/// Email Property Name.
		/// </summary>
		public const string EmailProperty = "Email";
		/// <summary>
		/// E-mail for this user.
		/// </summary>
		[Property(ColumnType = "String", Length = 255)]
		[ValidateEmail()]
		public string Email {
			get {
				return this._email;
			}
			set {
				this._email = value;
			}
		}

		/// <summary>
		/// LastLoginDate Property Name.
		/// </summary>
		public const string LastLoginDateProperty = "LastLoginDate";
		/// <summary>
		/// Last login date.
		/// </summary>
		[Property(ColumnType = "DateTime", NotNull = false)]
		public DateTime? LastLoginDate {
			get {
				return this._lastLoginDate;
			}
			set {
				this._lastLoginDate = value;
			}
		}

		/// <summary>
		/// Description Property Name.
		/// </summary>
		public const string DescriptionProperty = "Description";
		/// <summary>
		/// Description of this user.
		/// </summary>
		[Property(ColumnType = "StringClob")]
		public string Description {
			get {
				return this._description;
			}
			set {
				this._description = value;
			}
		}

		/// <summary>
		/// User Property Name.
		/// </summary>
		public const string UserProperty = "User";
		/// <summary>
		/// User that this membership belongs to.
		/// </summary>
		[OneToOne(ForeignKey="UserId")]
		public UserEntity User {
			get {
				return this._user;
			}
			set {
				this._user = value;
			}
		}
		#endregion Properties
	}
}
